Skip to content

Maven, Gradle: emit DependenciesDeclared table from FindDependency#7530

Merged
MBoegers merged 3 commits intomainfrom
MBoegers/find-dep-data-table
May 5, 2026
Merged

Maven, Gradle: emit DependenciesDeclared table from FindDependency#7530
MBoegers merged 3 commits intomainfrom
MBoegers/find-dep-data-table

Conversation

@MBoegers
Copy link
Copy Markdown
Contributor

Summary

  • Adds a new shared org.openrewrite.maven.table.DependenciesDeclared data table.
  • Wires both rewrite-maven and rewrite-gradle FindDependency recipes to emit one row per declared (direct) dependency match, alongside the existing SearchResult markers.
  • Schema mirrors DependenciesInUse minus the count column (always 1 by construction).

Why

FindDependency was the only "declared/direct only" search recipe without a data table — the DependencyInsight family already follows the Find emits SearchMarkers AND DataTables convention. Consumers wanting a clean, transitive-free list of declared coordinates currently have to either filter DependenciesInUse (which has no isDirect column) or live without table output.

A new table (rather than reusing DependenciesInUse with count = 1) keeps the existing table's "direct + transitive" contract intact and lets pipelines that run both DependencyInsight and FindDependency keep their row sets disambiguated by table identity.

Test plan

  • ./gradlew :rewrite-maven:test --tests "*FindDependencyTest*" (11/11 green; new tests assert row content, scope defaulting to compile, declared <scope> propagation, and that the table only sees declared coordinates)
  • ./gradlew :rewrite-gradle:test --tests "*FindDependencyTest*" (green; new tests assert row content for Groovy DSL and Kotlin DSL via withToolingApi())
  • ./gradlew :rewrite-maven:licenseFormat :rewrite-gradle:licenseFormat (UP-TO-DATE)
  • ./gradlew :rewrite-maven:recipeCsvValidate :rewrite-gradle:recipeCsvValidate (content + completeness pass; recipes.csv regenerated to include the new dataTables entry)

Adds a new shared DependenciesDeclared data table in
org.openrewrite.maven.table. Both rewrite-maven and rewrite-gradle
FindDependency recipes populate it alongside the existing SearchResult
markers, one row per declared dependency match.

Schema mirrors DependenciesInUse minus the count column (every row is
direct by construction). Single shared class follows the existing
precedent: rewrite-gradle already imports
org.openrewrite.maven.table.DependenciesInUse from rewrite-maven.
MBoegers added 2 commits May 5, 2026 09:23
# Conflicts:
#	rewrite-gradle/src/main/resources/META-INF/rewrite/recipes.csv
#	rewrite-maven/src/main/resources/META-INF/rewrite/recipes.csv
Re-applies the recipes.csv updates that were lost during the merge from
main, so the catalog reflects the DependenciesDeclared data table now
emitted by both FindDependency recipes.
@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite May 5, 2026
@MBoegers MBoegers merged commit ad0ff65 into main May 5, 2026
1 check passed
@MBoegers MBoegers deleted the MBoegers/find-dep-data-table branch May 5, 2026 09:04
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants